import time
from tqdm import tqdm # pip install tqdm
import concurrent.futures as cf
from alive_progress import alive_bar

def func1(i):
    time.sleep(1)

def main(num):
    # with tqdm(total=num) as bar: # 进度条
    with alive_bar(total=num, title='个数', bar='filling', spinner='waves') as bar: # 进度条
        with cf.ThreadPoolExecutor() as p: # 线程池
            for i in range(num):
                # p.submit(func1,i).add_done_callback(lambda func: bar.update())
                p.submit(func1,i).add_done_callback(lambda func: bar())

if __name__ == '__main__':
    main(100)
